/* 禁用浏览器手势导航 */
html {
    overscroll-behavior: none;
    -webkit-overflow-scrolling: touch;
}

body {
    background-color: #f9fafb;
    background-image: url("data:image/svg+xml,%3Csvg width='100' height='100' viewBox='0 0 100 100' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M11 18c3.866 0 7-3.134 7-7s-3.134-7-7-7-7 3.134-7 7 3.134 7 7 7zm48 25c3.866 0 7-3.134 7-7s-3.134-7-7-7-7 3.134-7 7 3.134 7 7 7zm-43-7c1.657 0 3-1.343 3-3s-1.343-3-3-3-3 1.343-3 3 1.343 3 3 3zm63 31c1.657 0 3-1.343 3-3s-2.24-5-5-5-5 2.24-5 5 2.24 5 5 5z-6 60c2.21 0 4-1.343 4-4s-1.343-4-4-4-4 1.343-4 4 1.343 4 4 4zm29 22c2.76 0 5-2.24 5-5s-2.24-5-5-5-5 2.24-5 5 2.24 5 5 5zM32 63c2.76 0 5-2.24 5-5s-2.24-5-5-5-5 2.24-5 5 2.24 5 5 5zm57-13c2.76 0 5-2.24 5-5s-2.24-5-5-5-5 2.24-5 5 2.24 5 5 5zm-9-21c1.105 0 2-.895 2-2s-.895-2-2-2-2 .895-2 2 .895 2 2 2zM60 91c1.105 0 2-.895 2-2s-.895-2-2-2-2 .895-2 2 .895 2 2 2zM35 41c1.105 0 2-.895 2-2s-.895-2-2-2-2 .895-2 2 .895 2 2 2zM12 60c1.105 0 2-.895 2-2s-.895-2-2-2-2 .895-2 2 .895 2 2 2z' fill='%23e5e7eb' fill-opacity='0.3' fill-rule='evenodd'/%3E%3C/svg%3E");
    background-attachment: fixed;
    min-height: 100vh;
    overscroll-behavior: none;
    -webkit-overflow-scrolling: touch;
}
/* 在CSS文件中添加 */
input, textarea {
    pointer-events: auto !important;
    touch-action: auto !important;
}

.draggable {
    transition: opacity 0.2s, transform 0.2s;
    touch-action: none;
}

/* 右键菜单样式 */
.context-menu {
    position: absolute;
    background: white;
    border-radius: 6px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    padding: 6px 0;
    z-index: 1000;
    min-width: 120px;
    display: none;
}

.context-menu-item {
    padding: 8px 16px;
    cursor: pointer;
    font-size: 14px;
    transition: background-color 0.2s;
}

.context-menu-item:hover {
    background-color: #f3f4f6;
}

.context-menu-item.delete {
    color: #ef4444;
}

/* 确认删除浮层 */
.confirm-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1001;
    display: none;
}

.confirm-dialog {
    background: white;
    border-radius: 8px;
    padding: 20px;
    max-width: 300px;
    width: 90%;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

.confirm-dialog h3 {
    margin-top: 0;
    margin-bottom: 16px;
    font-size: 16px;
    font-weight: 600;
}

.confirm-buttons {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
}

.confirm-buttons button {
    padding: 8px 16px;
    border-radius: 4px;
    font-size: 14px;
    cursor: pointer;
}
.draggable.dragging {
    opacity: 0.8;
    transform: scale(1.1);
    z-index: 100;
    transition: none; /* 禁用过渡动画，确保拖拽时立即生效 */
}
.icon-grid {
    grid-template-columns: repeat(auto-fill, minmax(90px, 1fr));
    min-height: 200px;
    gap: 20px;
    padding: 15px 5px;
}
.tab-scroll {
    -ms-overflow-style: none;
    scrollbar-width: none;
}
.tab-scroll::-webkit-scrollbar {
    display: none;
}
.app-icon {
    width: 70px;
    height: 70px;
    border-radius: 18px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 10px;
    background: linear-gradient(135deg, #6366f1, #8b5cf6);
    color: white;
    font-size: 32px;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.15);
}
@media (max-width: 640px) {
    .icon-grid {
        grid-template-columns: repeat(4, 1fr);
        gap: 16px;
    }
    .app-icon {
        width: 55px;
        height: 55px;
        font-size: 26px;
        border-radius: 15px;
    }
}
.drop-indicator {
    border: 2px dashed #3b82f6;
    background-color: rgba(59, 130, 246, 0.1);
}
.drop-hover {
    background-color: rgba(59, 130, 246, 0.2) !important;
    border: 2px dashed #3b82f6 !important;
}

/* 标签页拖拽悬停效果 */
.tab-btn.drop-hover {
    background-color: rgba(59, 130, 246, 0.3) !important;
    border: 2px solid #3b82f6 !important;
    transform: scale(1.05);
    transition: all 0.2s ease;
}
.tooltip {
    position: absolute;
    visibility: hidden;
    opacity: 0;
    transition: opacity 0.3s, visibility 0.3s;
    z-index: 50;
}
.has-tooltip:hover .tooltip {
    visibility: visible;
    opacity: 1;
}
.content-container {
    transition: transform 0.3s ease;
    touch-action: pan-y;
    min-height: calc(100vh - 140px);
    position: relative;
    overflow: hidden;
    will-change: transform;
}

html, body {
    overflow-x: hidden;
    position: relative;
    width: 100%;
    height: 100%;
}
.tab-indicator {
    display: flex;
    justify-content: center;
    position: fixed;
    bottom: 20px;
    left: 0;
    right: 0;
    height: 20px;
    z-index: 50; /* 提高z-index确保始终在最上层 */
    pointer-events: auto;
    background-color: transparent;
}
.indicator-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background-color: #d1d5db;
    margin: 0 4px;
    transition: background-color 0.3s;
    cursor: pointer;
}
.indicator-dot.active {
    background-color: #3b82f6;
    transform: scale(1.2);
}
.tab-drop-zone {
    display: none;
    position: fixed;
    z-index: 40;
    background-color: rgba(59, 130, 246, 0.15);
    border: 2px dashed #3b82f6;
    padding: 10px;
    border-radius: 10px;
    font-size: 14px;
    color: #3b82f6;
    pointer-events: none;
}
.tab-context-menu {
    position: absolute;
    background: white;
    border-radius: 8px;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    padding: 8px 0;
    z-index: 100;
    min-width: 150px;
}
.context-menu-item {
    padding: 8px 16px;
    cursor: pointer;
    transition: background-color 0.2s;
}
.context-menu-item:hover {
    background-color: #f3f4f6;
}
.context-menu-item.delete {
    color: #ef4444;
}
.pulse-animation {
    animation: pulse 1.5s infinite;
    box-shadow: 0 0 0 rgba(59, 130, 246, 0.4);
}
@keyframes pulse {
    0% {
        box-shadow: 0 0 0 0 rgba(59, 130, 246, 0.4);
    }
    70% {
        box-shadow: 0 0 0 10px rgba(59, 130, 246, 0);
    }
    100% {
        box-shadow: 0 0 0 0 rgba(59, 130, 246, 0);
    }
}
.tab-bar::-webkit-scrollbar {
    width: 8px;
}
.tab-bar::-webkit-scrollbar-track {
    background-color: transparent;
}
.tab-bar::-webkit-scrollbar-thumb {
    background-color: rgba(156, 163, 175, 0.5);
    border-radius: 10px;
}
.tab-bar::-webkit-scrollbar-thumb:hover {
    background-color: rgba(156, 163, 175, 0.7);
}

/* 图片裁剪相关样式 */
.cropper-container {
    max-height: 400px;
    overflow: hidden;
}
.preview {
    width: 100px;
    height: 100px;
    overflow: hidden;
    border-radius: 50%;
    border: 1px solid #ddd;
}
.custom-image-preview {
    width: 100%;
    height: 100%;
    object-fit: cover;
    position: absolute;
    top: 0;
    left: 0;
    border-radius: inherit; /* 继承父元素的圆角 */
    background-color: transparent; /* 确保背景透明 */
    mix-blend-mode: normal; /* 确保透明度正确混合 */
}
.app-icon.relative {
    background-color: transparent !important;   /* 确保背景透明 */
    overflow: hidden;
}

/* Emoji选择器滚动条样式 */
#emoji-picker::-webkit-scrollbar {
    width: 8px;
}
#emoji-picker::-webkit-scrollbar-track {
    background-color: #f1f1f1;
    border-radius: 10px;
}
#emoji-picker::-webkit-scrollbar-thumb {
    background-color: #d1d5db;
    border-radius: 10px;
}
#emoji-picker::-webkit-scrollbar-thumb:hover {
    background-color: #9ca3af;
}

/* 模态框通用解决方案 - 确保所有输入控件可点击 */
#modal {
    pointer-events: auto !important;
}

#modal .modal-content {
    pointer-events: auto !important;
    z-index: 55;
}

/* 通用选择器，匹配所有表单元素和交互元素 */
#modal input, 
#modal textarea,
#modal select,
#modal button,
#modal label,
#modal [role="button"],
#modal a,
#modal .emoji-option,
#modal .clickable,
#modal .form-control,
#modal [tabindex],
#modal [contenteditable="true"] {
    pointer-events: auto !important;
    position: relative;
    z-index: 60;
    touch-action: auto !important;
    cursor: auto;
    user-select: auto !important;
}

/* 根据元素类型设置适当的光标样式 */
#modal input[type="text"],
#modal input[type="url"],
#modal input[type="email"],
#modal input[type="password"],
#modal input[type="search"],
#modal input[type="tel"],
#modal input[type="number"],
#modal textarea,
#modal [contenteditable="true"] {
    cursor: text !important;
}

#modal input[type="radio"],
#modal input[type="checkbox"],
#modal button,
#modal [role="button"],
#modal a,
#modal .emoji-option,
#modal .clickable {
    cursor: pointer !important;
}

#modal #emoji-picker {
    z-index: 60;
}

#modal #image-upload {
    z-index: 60;
}